#ifndef MRPCCONTROLLER_H
#define MRPCCONTROLLER_H

#pragma once
#include <google/protobuf/service.h>
#include <string>
class MRpcController : public google::protobuf::RpcController {
public:
    MRpcController() = default;
    ~MRpcController() = default;
    void Reset() override {
        failed_ = false;
        reason_.clear();
    };
    void SetFailed(const std::string& reason) {
        failed_ = true;
        reason_ = reason;
    };
    bool Failed() const {
        return failed_;
    };
    std::string ErrorText() const {
        return reason_;
    };

    void StartCancel() {};
    bool IsCanceled() const {return false;};
    void NotifyOnCancel(google::protobuf::Closure* callback) {};

private:
    std::string reason_;
    bool failed_ = false;
};

#endif